package com.zhb.designmode.structure.agency.dynamic.jdk;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

public class DynamicProxyHandler implements InvocationHandler {

    private Object object;

    public DynamicProxyHandler(Object object) {
        this.object = object;
    }

    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("买房前寻找房源");
        Object invoke = method.invoke(object, args);
        System.out.println("买房后签订合同");
        return invoke;
    }
}
